package com.njmaomao.gj.pyot.domain.wechat.wechatapi;

import java.util.Optional;

public interface ApiResp {

    String getReturnCode();

    Optional<String> getReturnMsg();

    String getResultCode();

    String getErrCode();

    String getErrCodeDes();

    //调用是否成功
    default boolean isCallSuccess() {
        return "SUCCESS".equals(getReturnCode());
    }

    //业务是否成功
    default boolean isBizSuccess() {
        return "SUCCESS".equals(getResultCode());
    }

    default String errDesc() {
        if(!"SUCCESS".equals(getReturnCode())) {
            return getReturnMsg().orElse("微信接口调用异常");
        }
        return "";
    }

}
